#ifndef _JPHYSUTILS_H_
#define _JPHYSUTILS_H_

#include "JPhysDefines.h"
#include <stdio.h>
#include <stdarg.h>

// Basic Debug printing for JPhysics, use instead of printf
void JPDebugPrint(const char* fmt, ...);

#ifdef JP_ASSERTS_ON

// Variation of JPDebugPrint that is used only for Asserts listing file and line number
void JPAssertPrint(const char* file, int line, const char* cond);

#define JP_TRACE(fmt, ...) {JPDebugPrint(fmt, ##__VA_ARGS__);}
#define JP_ASSERT(cond) {if (cond) {JPAssertPrint(__FILE__, __LINE__, #cond); JP_DEBUG_BREAK;}}

#else

// JP_ASSERTS_ON is normally not defined in release
#define JP_TRACE(fmt, ...) {}
#define JP_ASSERT(cond) {}

#endif // JP_ASSERTS_ON

// JP_ASSERT_TRAP wont assert in release but will still run code;
#define JP_ASSERT_TRAP(cond, code) {if (cond) {JP_ASSERT(cond); code;}}

#endif // _JPHYSUTILS_H_
